import request from '@/utils/request'

// 查询在线设备列表
export function listDevice(query) {
  return request({
    url: '/lims/contract/device/list',
    method: 'get',
    params: query
  })
}

// 查询在线设备详细
export function getDevice(deviceId) {
  return request({
    url: '/lims/contract/device/' + deviceId,
    method: 'get'
  })
}

// 新增在线设备
export function addDevice(data) {
  return request({
    url: '/lims/contract/device',
    method: 'post',
    data: data
  })
}

// 修改在线设备
export function updateDevice(data) {
  return request({
    url: '/lims/contract/device',
    method: 'put',
    data: data
  })
}

// 删除在线设备
export function delDevice(deviceId) {
  return request({
    url: '/lims/contract/device/delete/' + deviceId,
    method: 'delete'
  })
}

/**
 * @param {Object} data 新增基础设备信息
 * @returns promise
 */
export const addBasicDeviceInfoAPI = (data) => request({
    url: "/lims/contract/device",
    method: "POST",
    data
})

/**
 * 新增或编辑检测项目
 * @param {object} data 检测项目信息
 * @returns promise
 */
export const addOrEditMethodAPI = (data) => request({
    url: "lims/contract/jcxm",
    method: "POST",
    data
})

export const getJcxmList = (jclbId) => request({
    url: "lims/contract/jcxm/jcxmListByJclbId/" + jclbId
})

export const getArgumentsMethodIdAPI= (query) => request({
    url: "lims/contract/jcxm/methodList",
    params: {
       jcxmId: query.jcxmId,
       jclbId: query.jclbId
    }
})

export const echoAPI = (dJId) => request({
    url: "lims/contract/jcxm/" + dJId,
    method: "get",
})

export const deleteJcxmAPI = (methodArr) => request({
    url: "lims/contract/jcxm/delete" + methodArr,
    method: "DELETE",
})